'''
Created on 2017年10月8日

@author: Administrator

序列化
'''
import pickle

if __name__ == '__main__':
   d = dict(name='Bob', age=20, score=88)
   data = pickle.dumps(d)
   print(data)
   reborn = pickle.loads(data)
   print(reborn)
   #写入到文件
   f=open("dump.txt","wb")
   pickle.dump(d,f)
   f.close()
   #读取
   f=open("dump.txt","rb")
   d=pickle.load(f)
   f.close()
   print(d)